package com.example.demo.Work.Consumer;

import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

@Component
// Declare:声明                                 队列名               队列持久化 durable:持久耐用  自动删除
@RabbitListener(queuesToDeclare = @Queue(value = "Work_RabbitMq",durable = "true",autoDelete = "false"))
public class Consumer1 {
    /**
     * Handler:处理者
     * @param message
     * @RabbitHandler 注解是指定某方法作为消息消费的方法,例如监听某Queue 里面的消息。
     */
    @RabbitHandler
    public void HelloConsumer(String message){
        System.out.println("消费者1消费："+message);
    }
}
